Functions

bool isValid void UseSprite bool Behind int ID int X int Y int Z int Jump int DrawStyle int Dir int OriginalTile int Tile int OriginalCSet int CSet int FlashCSet int NumFrames int Frame int ASpeed int Damage int Step int Angle bool Angular bool CollDetection int DeadState bool Flash int Flip int Extend int TileWidth int TileHeight int HitWidth int HitHeight int HitZHeight int HitXOffset int HitYOffset int DrawXOffset int DrawYOffset int DrawZOffset float Misc[]
Back to Top
Pages: Global | FFC | Link | Screen | Item | Weapon | Itemdata | Game | NPC | std | string

Weapon Functions and Variables Documentation

Functions and Properties

Return Type Function Information
boolisValid()
Returns whether this weapon pointer is still valid. A weapon pointer
becomes invalid when the weapon fades away or disappears
or Link leaves the screen. Accessing any variables using an
invalid weapon pointer prints an error message to allegro.log and
does nothing.
voidUseSprite(int id)
Reads a 'Weapons/Misc' sprite entry in your quest file, and assigns
the OriginalTile, Tile, OriginalCSet, CSet, FlashCSet, NumFrames
Frame, ASpeed, Flip and Flash variables of this weapon based on
this entry's data. Passing negative values, and values greater than
255, will do nothing.
boolBehind
Ensures that the weapon's graphic is drawn behind Link and enemies.
intID
The weapon's ID number. Use the LW_ or EW_ constants to compare
this value. The effect of writing to this field is currently undefined.
intX
The weapon's X position on the screen, in pixels. Float values passed
to this will be cast to int.
intY
The weapon's Y position on the screen, in pixels. Float values passed
to this will be cast to int.
intZ
The weapon's Z position on the screen, in pixels. Float values passed
to this will be cast to int.
intJump
The weapon's falling speed on the screen. Bombs, Bait and
Fire obey gravity.
intDrawStyle
An integer representing how the weapon is to be drawn. Use one of the
DS_ constants in std.zh to set or compare this value.
intDir
The direction that the weapon is facing. Used by certain weapon types
to determine movement, shield deflection and such.
intOriginalTile
The starting tile of the weapon's animation.
intTile
The current tile associated with this weapon.
intOriginalCSet
The starting CSet of the weapon's animation.
intCSet
This weapon's current CSet.
intFlashCSet
The CSet used during this weapon's flash frames, if this weapon flashes.
intNumFrames
The number of frames in this weapon's animation.
intFrame
The weapon's current animation frame.
intASpeed
The speed at which this weapon animates, in screen frames.
intDamage
The amount of damage that this weapon causes to Link/an enemy upon contact.
intStep
Usually associated with the weapon's velocity. A Step of 100
typically means that the weapon moves at approximately one pixel
per animation frame.
intAngle
The weapon's current angle in clockwise radians; used by certain weapon
types with angular movement. 0 = right, PI/2 = down, etc. Note: if you
want Link's shield to interact with the weapon correctly, you must set
its Dir to a direction that approximates this angle.
boolAngular
Specifies whether a weapon has angular movement.
boolCollDetection
Whether the weapon will use the system's code to work out collisions with
Link and/or enemies (depending on weapon type). Initialised as 'true'.
intDeadState
The current state of the weapon. Important to keep track of. A value of
-1 indicates that it is active, and moves according to the weapon's
Dir, Step, Angular, and Angle values. Use -1 if you want the engine to
handle movement and collision. Use any value below -1 if you want a
dummy weapon that you can control on your own.
Given a deadstate value of -10, a weapon will turn of its collision
detection and movement. If it has a positive value, it will
decrement once per frame until it equals 0, whereupon the weapon is
removed. If you want to remove the weapon, write one of the WDS_
constants in std.zh (appropriate for the weapon) to this variable.
boolFlash
Whether or not the weapon flashes. A flashing weapon alternates between
its CSet and its FlashCSet.
intFlip
Whether and how the weapon's tiles should be flipped.
0: No flip
1: Horizontal flip
2: Vertical flip
3: Both (180 degree rotation)
intExtend
Whether to extend the sprite of the weapon.
intTileWidth
The number of tile columns composing the sprite.
Writing to this is ignored unless Extend is set to values >=3.
intTileHeight
The number of tile rows composing the sprite.
Writing to this is ignored unless Extend is set to values >=3.
intHitWidth
The width of the sprite's hitbox, or collision rectangle.
intHitHeight
The height of the sprite's hitbox, or collision rectangle.
intHitZHeight
The Z-axis height of the sprite's hitbox, or collision rectangle.
The greater it is, the higher Link must jump or fly over the sprite
to avoid taking damage.
intHitXOffset
The X offset of the sprite's hitbox, or collision rectangle.
Setting it to positive or negative values will move the sprite's
hitbox left or right.
intHitYOffset
The Y offset of the sprite's hitbox, or collision rectangle.
Setting it to positive or negative values will move the sprite's
hitbox up or down.
intDrawXOffset
The X offset of the sprite.
Setting it to positive or negative values will move the sprite's
tiles left or right relative to its position.
intDrawYOffset
The Y offset of the sprite.
Setting it to positive or negative values will move the sprite's
tiles up or down relative to its position.
intDrawZOffset
The Z offset of the sprite.
floatMisc[]
An array of 16 miscellaneous variables for you to use as you please.